/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.cersoft.xmascharity.entity;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 *
 * @author pbo
 */

@NamedQueries({
    @NamedQuery(name = "findSum",query = "SELECT SUM(p.amount) FROM Payment p"), 
    @NamedQuery(name = "findPayments", query = "SELECT p FROM Payment p")
})
@Entity
public class Payment implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private Long id;

    private String payerName;
    
    private String email;
    
    private double amount;
    
    @Temporal(TemporalType.TIMESTAMP)
    private Date requestDate;
    
    @Temporal(TemporalType.TIMESTAMP)
    private Date realizationDate;
    
    private String dotPayId;

    public double getAmount() {
        return amount;
    }

    public void setAmount(double amount) {
        this.amount = amount;
    }

    public String getDotPayId() {
        return dotPayId;
    }

    public void setDotPayId(String dotPayId) {
        this.dotPayId = dotPayId;
    }

    public String getDotPayStatus() {
        return dotPayStatus;
    }

    public void setDotPayStatus(String dotPayStatus) {
        this.dotPayStatus = dotPayStatus;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public String getPayerName() {
        return payerName;
    }

    public void setPayerName(String payerName) {
        this.payerName = payerName;
    }

    public Date getRealizationDate() {
        return realizationDate;
    }

    public void setRealizationDate(Date realizationDate) {
        this.realizationDate = realizationDate;
    }

    public Date getRequestDate() {
        return requestDate;
    }

    public void setRequestDate(Date requestDate) {
        this.requestDate = requestDate;
    }
    
    private String dotPayStatus;
    
    
    
    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Payment)) {
            return false;
        }
        Payment other = (Payment) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "pbo.entity.Payment[ id=" + id + " ]";
    }
    
}
